<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>mypromise</title>
</head>

<body>
    <script type='module'>
        import MyPromise from './mypromise.js'

        new MyPromise((resolve, reject) => {
            setTimeout(() => resolve('success'))
        })
            .then(s => {
                console.log(s)
                return '成功'
            }, v => console.log(v))
            .then(
                s => {
                    console.log(s)
                    return new MyPromise((resolve, reject) => {
                        resolve('yahoo')
                    })
                },
                v => console.log(v)
            )
            .then(
                s => {
                    console.log(s)
                    return '结束'
                },
                v => console.log(v)
            )
            .then(
                s => {
                    console.log(s)
                },
                v => console.log(v)
            )
        console.log('同步')
    </script>
</body>

</html>